package com.tank.manager;

import java.io.IOException;
import java.util.Properties;

public class PropertyManager {

    private static class PropertyHolder {
        public static Properties properties = new Properties();
    }

    public static Properties getInstance() {
        return PropertyHolder.properties;
    }

    static {
        try {
            getInstance().load(PropertyManager.class.getClassLoader().getResourceAsStream("application.yml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private PropertyManager() {}

    public static Object get(String key) {
        if (getInstance() == null) {
            return null;
        }
        if (key == null || key.length() == 0) {
            return null;
        }
        return getInstance().get(key);
    }
}
